package com.cc.blog.admin.controller;

import com.cc.blog.admin.domain.dto.UpdateAdminUserPasswordReqDTO;
import com.cc.blog.admin.service.AdminUserService;
import com.cc.blog.common.annotation.ApiOperationLog;
import com.cc.blog.common.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author cc
 * @Date 2024/7/10 10:34
 */
@RestController
@RequestMapping("/admin")
@Api(tags = "Admin 用户模块")
@AllArgsConstructor
public class AdminUserController {

    private final AdminUserService userService;

    @PostMapping("/password/update")
    @ApiOperation(value = "修改用户密码")
    @ApiOperationLog(description = "修改用户密码")
    public Result updatePassword(@RequestBody @Validated UpdateAdminUserPasswordReqDTO updateAdminUserPasswordReqVO) {
        return userService.updatePassword(updateAdminUserPasswordReqVO);
    }

    @PostMapping("/user/info")
    @ApiOperation(value = "获取用户信息")
    @ApiOperationLog(description = "获取用户信息")
    public Result findUserInfo() {
        return userService.findUserInfo();
    }
}
